/* static/css/style.css */

/* 基础样式 */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

.navbar {
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* 卡片样式 */
.card {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* 文章卡片特定样式 */
.post-card {
    border-left: 4px solid #007bff;
}

.post-card:hover {
    border-left-color: #0056b3;
}

.post-title {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

.post-title a {
    color: inherit;
    transition: color 0.3s ease;
}

.post-title a:hover {
    color: #007bff !important;
    text-decoration: none !important;
}

/* 文章预览样式 */
.post-preview {
    color: #6c757d;
    line-height: 1.7;
    font-size: 1.05rem;
}

.post-preview a {
    color: inherit;
    transition: color 0.3s ease;
}

.post-preview a:hover {
    color: #007bff !important;
    text-decoration: none !important;
}

.read-more {
    color: #007bff;
    font-weight: 500;
    font-size: 0.9rem;
}

.post-preview a:hover .read-more {
    text-decoration: underline !important;
}

/* 文章元信息样式 */
.post-meta {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
    margin-top: 1rem;
}

.post-meta small {
    font-size: 0.85rem;
}

.post-meta .btn-group {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.post-card:hover .post-meta .btn-group {
    opacity: 1;
}

/* 侧边栏样式 */
.sidebar-card {
    position: sticky;
    top: 20px;
}

.sidebar-card .card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* 按钮样式 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid #007bff;
    color: #007bff;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #007bff;
    border-color: #007bff;
    transform: translateY(-1px);
}

.btn-outline-danger {
    border: 2px solid #dc3545;
    color: #dc3545;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    transform: translateY(-1px);
}

.btn-outline-warning {
    border: 2px solid #ffc107;
    color: #ffc107;
    background: transparent;
}

.btn-outline-warning:hover {
    background: #ffc107;
    border-color: #ffc107;
    color: #000;
    transform: translateY(-1px);
}

.btn-outline-info {
    border: 2px solid #0dcaf0;
    color: #0dcaf0;
    background: transparent;
}

.btn-outline-info:hover {
    background: #0dcaf0;
    border-color: #0dcaf0;
    color: #000;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    border-color: #6c757d;
    transform: translateY(-1px);
}

/* 表单样式 */
.form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
    border-color: #007bff;
}

/* 警告框样式 */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

/* 统计数字样式 */
.text-center h3 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* 文章详情页样式 */
.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap; /* 保留换行符 */
    word-wrap: break-word;
}

.post-content br {
    margin-bottom: 0.5rem;
}

/* 评论样式 */
.comments-section .card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.comments-section .card-body {
    padding: 1rem;
}

.comment-author {
    font-weight: 600;
    color: #495057;
}

.comment-date {
    font-size: 0.85rem;
    color: #6c757d;
}

.comment-content {
    line-height: 1.5;
    color: #333;
}

/* 评论表单样式 */
.comment-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* 搜索高亮样式 */
mark {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 3px;
}

/* 搜索框样式 */
.navbar .form-control {
    font-size: 0.9rem;
}

/* 搜索结果卡片样式 */
.search-result-card {
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.search-result-card:hover {
    border-left-color: #0056b3;
    transform: translateX(5px);
}

/* 搜索统计信息 */
.search-stats {
    font-size: 0.9rem;
    color: #6c757d;
}

/* 用户资料页样式 */
.user-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.user-stats {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.user-stats h5 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.user-stats p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* 用户文章列表样式 */
.user-post-item {
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.user-post-item:hover {
    border-left-color: #007bff;
    background-color: #f8f9fa;
}

.user-post-item .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.user-post-item .card-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 头像样式 */
.account-img {
    border: 3px solid #007bff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.rounded-circle {
    border-radius: 50% !important;
}

/* 下拉菜单样式 */
.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
}

.dropdown-item {
    border-radius: 6px;
    margin: 2px 8px;
    width: auto;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #007bff;
    color: white;
}

/* 文件上传样式 */
.form-control[type="file"] {
    padding: 0.5rem;
}

.form-control[type="file"]::file-selector-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    margin-right: 0.75rem;
    transition: all 0.3s ease;
}

.form-control[type="file"]::file-selector-button:hover {
    background: #e9ecef;
}

/* 徽章样式 */
.badge {
    font-size: 0.75em;
}

/* 分页样式 */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .card {
        margin-bottom: 1rem;
    }

    .post-title {
        font-size: 1.25rem;
    }

    .post-preview {
        font-size: 1rem;
    }

    .btn-group {
        margin-top: 10px;
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    .sidebar-card {
        margin-top: 2rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .post-meta > div:first-child {
        margin-bottom: 10px;
    }

    /* 响应式搜索框 */
    .navbar .d-flex {
        width: 100%;
        margin: 10px 0;
    }

    .navbar .form-control {
        width: 100% !important;
    }

    .navbar-nav {
        margin-top: 10px;
    }

    /* 响应式头像 */
    .account-img {
        width: 120px !important;
        height: 120px !important;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.25rem;
    }

    .card-body {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .post-content {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* 移动端头像 */
    .rounded-circle {
        width: 80px !important;
        height: 80px !important;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* 链接样式 */
a {
    transition: color 0.3s ease;
}

.text-muted {
    color: #6c757d !important;
}

/* 按钮组间距 */
.btn-group .btn {
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* 实用类 */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.rounded-lg {
    border-radius: 12px !important;
}